TOPE = 1000000

def lnp1(i):
	l = list()
	l.append(i)
	n = np1(i)
	l.append(n)
	while (n != 1):
		n = np1(n)
		l.append(n)
	return l

def np1(n):
	if n % 2 == 0:
		return n / 2
	return (3 * n) + 1

if __name__ == '__main__':
	import os
	os.system('cls')

	max = 0
	n = 0
	for x in range(TOPE, 5, -1):
		l = lnp1(x)
		if len(l) > max:
			max = len(l)
			n = x
	
	print '\n\t', n, '\n' 
